package com.phuc.game.tankshooter;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class TutorialActivity extends Activity {

	public static final int []ids = new int[] {
		R.drawable.tuto_1,
		R.drawable.tuto_2,
		R.drawable.tuto_3,
		R.drawable.tuto_4,
		R.drawable.tuto_5,
		R.drawable.tuto_6,
		R.drawable.tuto_7,
		R.drawable.tuto_8
	}; 
	
	int currentIndex;
	ImageView img;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tutorial);
		currentIndex = 0;
		img = (ImageView)findViewById(R.id.tutorial_img);
	}
	
	public void onButtonClick(View view) {
		findViewById(R.id.tutorial_txt).setVisibility(View.INVISIBLE);
		if (currentIndex == ids.length) {
			Intent intent = new Intent(this, MainActivity.class);
			startActivity(intent);
			finish();
			return;
		}
		img.setBackgroundResource(ids[currentIndex]);
		currentIndex++;
		if (currentIndex == ids.length - 1) {
			((Button)findViewById(R.id.tutorial_btn)).setText(R.string.let_go);
			((Button)findViewById(R.id.tutorial_btn)).setTextColor(Color.RED);
		}
	}
}
